const exp = require('express');
const ejs = require('ejs');
const data = require('./data/newdata.json');
const app = exp();
// app.set('views',__dirname+'/views')
app.engine('html',ejs.renderFile)
app.listen(80)
app.get('/list',(req,res)=>{
    res.render('list.html',{data})
})

app.get('/',(req,res)=>{
    res.redirect('/list')
})

app.get('/detail',(req,res)=>{
    let {id} = req.query;
    let obj = data.find(item=>id===item.id)
    res.render('detail.html',{obj})
})